package TransactionImplementation

import (
	"SPC/Database"
	"SPC/ModelImplementation"
	"time"

)

type TimeCardTransaction struct {
	itsDate time.Time
	itsHours float64
	itsEmpid int
}

func NewTimeCardTransaction(date time.Time, hours float64, empid int) *TimeCardTransaction{
	return &TimeCardTransaction{date, hours, empid}
}

func (t * TimeCardTransaction)Execute(){
	e := Database.GetPayrollDatabase().GetEmployee(t.itsEmpid)
	if (e.GetName() != "") {
		// var hc ModelImplementation.HourlyClassification = ModelImplementation.HourlyClassification(e.GetClassification())
		hc := ModelImplementation.GetHourlyClassification()
		hc.AddTimeCard(*ModelImplementation.NewTimeCard(t.itsDate, t.itsHours))
	}
}